# these next few lines import some of the WMP functions we will
# use in this file.
from frontend.roleApplication import RoleApplication
from frontend.form import Type

class BaggerApp(RoleApplication):
    '''
    The OrderTakerApplication "class" is a collection of the "methods" (functions) that 
    define the elements of the order taker application.  
    
    An application will always include the method __init__ and at least one
    method to define a form that the user of this application will use.
    '''

    def __init__(self):
        '''
        Declare this application to be part of a given work flow and specify its role in that workflow.
        '''
        # Declare this application to be part of a given workflow, and responsible for a given role:
        # !!! Modify the following to use the actual work flow name and role name you need...
        super(BaggerApp, self).__init__("GroceryStore", "Bagger") 
        # Declare any tasks that this role is able to perform:
        # !!! Modify to use actual name for this task...
        self.register_transition_step("Bag", self.paper_plastic)
        self.register_transition_step("FillCart", self.fill_cart)

    def paper_plastic(self, stepname, form):
        '''
        This method does the actual work of building the user interface.
        '''
        # !!! improve this text...
        form.add_static_label("Paper or plastic?")
        
        # !!! Add at least two fields here, along with any additional static labels you need...
        #After greeting, ask the customer if they found everything alright.
        form.add_field(Type.CHOICE, "BagType", labeltext="Bag Type", choices=['Paper', 'Plastic', 'Reusable Bag', 'Burlap Sack']);
        
    def fill_cart(self, stepname, form):
        #Title for the screen
        form.add_static_label("Here are your groceries.")
        
if __name__ == '__main__':
    #starts up the CustomerApp application:
    app = BaggerApp()
    #Start interacting with the user:
    app.MainLoop()